<template>
	<view class="wf-box">
		<view class="head" :style="{ paddingTop: navBarHeight }">
			<view class="head-np">
				<view class="back" @click="back()">
					<image src="../../static/img/chat-09.png"></image>
				</view>
				<view class="title">签到</view>
				<image @click="strategy()" class="img" src="../../static/img/signin_img3.png" mode="widthFix"></image>
			</view>
		</view>

		<view class="main" :style="{ paddingTop: navBarHeight }">
			<view class="award">
				<view class="award_top">
					<view>
						<view class="title">签到奖励</view>
						<view class="line">
							<view><text></text></view>
							<view>1/7天</view>
						</view>
					</view>
					<view class="btn" @click="sign()">立即签到</view>
				</view>
				<view class="award_down">
					<view>已连续签到1天</view>
					<view>每连续签到7天，首次连续签到28天可获得大额社交值</view>
				</view>
			</view>
			<view class="date">
				<view class="date_title">
					<uni-icons type="left" color="#999999" size="18"></uni-icons>
					<view>2024年3月</view>
					<uni-icons type="right" color="#999999" size="18"></uni-icons>
				</view>
				<view class="week">
					<view class="week_i" v-for="item in weekList">{{item}}</view>
				</view>
				<view class="week" v-for="(item,i) in list.length/7">
					<view class="week_d" v-for="item2 in list.slice(i*7,item*7)">
						<image v-if="item2==13" src="@/static/img/signin_img1.png" mode="widthFix"></image>
						<image v-else src="@/static/img/signin_img2.png" mode="widthFix"></image>
						<uni-icons v-if="item2==13" class="yes" color="#FF6301" type="checkbox-filled" size="10"></uni-icons>
						<image v-if="item2==25" class="box" src="@/static/img/signin_icon.png" mode="widthFix"></image>
						<view>{{item2}}</view>
					</view>
				</view>
			</view>
		</view>
		<uni-popup ref="popup" type="center">
			<view class="popup-box">
				<image src="@/static/img/sign_bg.png" mode="widthFix"></image>
				<view class="box_title">签到成功</view>
				<view class="box_text">已累计签到 <text>2</text> 天</view>
				<view class="box_num">
					<image src="@/static/img/signin_img4.png" mode="widthFix"></image>
					<view>+2.00</view>
				</view>
				<view @click="closePopup()" class="btn">我知道啦</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	import navBarMixin from '@/mixin/navBarMixin.js'
	export default {
		data() {
			return {
				weekList: ['日', '一', '二', '三', '四', '五', '六'],
				list: [
					'1','2','3','4','5','6','7','8','9','10','11','12','13','14',
					'15','16','17','18','19','20','21',
					'22','23','24','25','26','27','28',
					'29','30','31','32','33','34','35',
				]
			}
		},
		mixins: [navBarMixin],
		onLoad(option) {
			console.log(this.list.slice(0,7));
			console.log(this.list.slice(7,14));
			console.log(this.list.slice(14,21));
			console.log(this.list.slice(21,28));
		},
		methods: {
			sign() {
				this.$refs.popup.open()
			},
			openPopup() {
				this.$refs.popup.open()
			},
			closePopup() {
				this.$refs.popup.close()
			},
			back() {
				uni.navigateBack()
			},
			strategy() {
				uni.navigateTo({
					url: '/pages/me/signinStrategy'
				})
			},
		},
	}
</script>

<style lang="scss" scoped>
	.wf-box {
		overflow: hidden;

		.back {
			image {
				width: 20rpx;
				height: 37rpx;
			}
		}

		.head {
			position: fixed;
			z-index: 333;
			width: 100%;
			background: #fff;

			.head-np {
				display: flex;
				justify-content: space-between;
				align-items: center;
				width: 100%;
				height: 96rpx;
				padding: 0 30rpx;
				box-sizing: border-box;

				.title {
					font-size: 36rpx;
					font-weight: bold;
				}

				.img {
					width: 50rpx;
				}
			}
		}

		.main {
			// margin-top: 126rpx;
			margin-top: 246rpx;
			margin: 126rpx 30rpx 60rpx;

			.award {
				padding: 30rpx 30rpx;
				background: #FFFFFF;
				border-radius: 10rpx;

				.award_top {
					display: flex;
					justify-content: space-between;

					.btn {
						width: 154rpx;
						height: 64rpx;
						line-height: 64rpx;
						text-align: center;
						background: #FFB53A;
						border-radius: 32rpx;
						font-weight: 500;
						font-size: 26rpx;
						color: #FFFFFF;
						margin-top: auto;
					}

					.title {
						font-weight: 500;
						font-size: 34rpx;
					}

					.line {
						display: flex;
						align-items: center;
						margin-top: 10rpx;

						view {
							&:nth-of-type(1) {
								position: relative;
								width: 322rpx;
								height: 10rpx;
								background: #FFF4E4;
								border-radius: 5rpx;

								text {
									position: absolute;
									left: 0;
									top: 0;
									width: 30%;
									height: 10rpx;
									background: #FDC465;
									border-radius: 5rpx;
								}
							}

							&:nth-of-type(2) {
								font-size: 26rpx;
								color: #666666;
								margin-left: 10rpx;
							}
						}
					}
				}

				.award_down {
					line-height: 42rpx;
					font-size: 26rpx;
					color: #666666;
					margin-top: 30rpx;
				}
			}

			.date {
				overflow: hidden;
				margin-top: 36rpx;
				border-radius: 10rpx;
				background-color: white;
				padding-bottom: 30rpx;

				.date_title {
					display: flex;
					align-items: center;
					justify-content: space-between;
					margin: 26rpx 20rpx 30rpx;
				}
			}

			.week {
				display: flex;
				justify-content: space-between;
				margin: 0 18rpx;

				.week_i {
					width: 56rpx;
					// background-color: pink;
					text-align: center;
					font-size: 30rpx;
					color: #666666;
				}
				.week_d {
					margin-top: 30rpx;
					position: relative;
					image {
						width: 56rpx;
						display: block;
					}
					view {
						text-align: center;
						font-size: 22rpx;
						color: #666666;
						margin-top: 14rpx;
					}
					.yes {
						position: absolute;
						right: 0;
						top: 0;
					}
					.box {
						position: absolute;
						right: 0;
						top: 0;
						width: 18rpx;
					}
				}
			}
		}
		.popup-box {
			width: 520rpx;
			height: 560rpx;
			// margin: 300rpx auto 0;
			// padding: 0 50rpx;
			// padding-top: 140rpx;
			// padding-bottom: 40rpx;
			border-radius: 20rpx;
			box-sizing: border-box;
			background: #fff;
			position: relative;
			// overflow: hidden;
			text-align: center;
			
			// background: #666666 url('@/static/img/sign_bg.png') no-repeat;
			// background-position: top;
			// background-size: contain;
			>image {
				width: 520rpx;
				position: absolute;
				top: -160rpx;
				left: 0;
				z-index: 1000;
			}
			.box_title {
				font-weight: 500;
				font-size: 42rpx;
				padding-top: 210rpx;
				// margin: 214rpx auto 30rpx;
			}
			.box_text {
				font-size: 30rpx;
				margin-top: 30rpx;
				text{
					font-size: 34rpx;
					color: #FFAA82;
				}
			}
			.box_num {
				display: flex;
				align-items: center;
				justify-content: center;
				margin-top: 22rpx;
				image {
					width: 42rpx;
					margin-right: 16rpx;
				}
				view {
					font-weight: 500;
					font-size: 38rpx;
					color: #FFAA00;
				}
			}
			.btn {
				width: 359rpx;
				height: 64rpx;
				line-height: 64rpx;
				background: #FFAA00;
				border-radius: 42rpx;
				font-weight: 500;
				font-size: 30rpx;
				color: #FFFFFF;
				margin: 32rpx auto 0;
			}
		}
	}
</style>